<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<!--<%&#45;&#45;  bootctrap_fileinput  &#45;&#45;%>-->
<script type="text/javascript" src="/js/bootstrap-fileinput/js/fileinput.js"></script>
<script type="text/javascript" src="/js/bootstrap-fileinput/js/locales/zh.js"></script>
<link rel="stylesheet" type="text/css" href="/js/bootstrap-fileinput/css/fileinput.css"/>
<script>
  $('#myFile').fileinput({
    language: 'zh',//汉化
    uploadUrl:"/uploadController/upload",//上传地址
    showCaption: true,//是否展示显示框
    showUpload: true,//默认为true, false不显示上传按钮
    showRemove: true,//默认为true,false不显示移除按钮
    showClose: true,//默认为true, false不显示图片右上角的关闭按钮
    browseClass: 'btn btn-warning',//按钮变色
    //showPreview: true,
    //showUploadedThumbs: true
    //showBrowse:["txt",""],
    //autoReplace:true,
    allowedFileExtensions:['jpg','png','gif','txt','pdf','xls','xlsx'], //限制文件上传类型
    maxFileSize:2048,//设置文件上传大小 单位kb
    maxFileCount:5,//最大上传数量
    enctype: "multipart/form-data",//改为二进制
  // initialPreviewFileType:"image",
  // initialPreviewShowDelete:true,
  //initialPreview:"<%=path%>/file/download?myFile=${house.himg}",
  // initialPreviewAsData:true
  });

  //上传成功回调
  $('#myFile').on('fileuploaded',function(event, data, previewId, index){
    if(data.response != null){
      var aa = []
      $("[name=imgurl]").val(data.response.t);//abc.jpg  + "," + bcd.jpg
      aa.push($("#imgcolor").val())
      aa.push(data.response.t)
      imgurl.push(aa)
    }
  })
</script>
<body>
  <form class="form-horizontal" role="form" id="categoryid">
    <div class="form-group">
      <label for="imgcolor" class="col-sm-2 control-label">商品颜色</label>
      <div class="col-sm-10">
        <input  class="form-control" placeholder="颜色" id="imgcolor">
      </div>

      <label for="myFile" class="col-sm-2 control-label">商品图片</label>
      <div class="col-sm-10">
        <input type="file" class="form-control" id="myFile" placeholder="请输入路线名称" name="image">
        <input type="text" name="imgurl" id="imgurl">
      </div>
    </div>
  </form>
</body>
</html>